from django.db import models

# Create your models here.
from goods.models import Goods
from user.models import UserProfile


class Cart(models.Model):
    c_user = models.ForeignKey(UserProfile, on_delete=models.CASCADE, blank=True, null=True, verbose_name='用户')
    c_goods = models.ForeignKey(Goods, on_delete=models.CASCADE, verbose_name='商品')
    c_count = models.IntegerField(verbose_name='购物车里的商品数量', default=0)

    def __str__(self):
        return self.c_user + '的购物车'
        # return self.c_user

    class Meta:
        verbose_name = '购物车'
        verbose_name_plural = verbose_name
